package com.banshou.installs.ui.adapter;

import android.content.Context;
import android.view.View;

import com.banshou.installs.R;
import com.banshou.installs.model.dao.ResponseDY;
import com.zhy.adapter.recyclerview.CommonAdapter;
import com.zhy.adapter.recyclerview.base.ViewHolder;

import java.util.List;

/**
 * Created by cjq on 2018/4/19.
 * Email: stoic_yb@139.com
 * features:
 */
public class DYAdapter extends CommonAdapter<ResponseDY.DYList> {
    public interface onItemClickListener {
        void getId(String Id,String name);
    }

    public onItemClickListener listener;

    public void setOnItemOnClickListener(onItemClickListener listener) {
        this.listener = listener;
    }

    public DYAdapter(Context context, int layoutId, List<ResponseDY.DYList> datas) {
        super(context, layoutId, datas);
    }

    @Override
    protected void convert(ViewHolder holder, final ResponseDY.DYList dyList, int position) {
        holder.setText(R.id.address, dyList.getLabel());
        holder.setOnClickListener(R.id.main, new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                listener.getId(dyList.getId(),dyList.getLabel());
            }
        });
    }
}
